package controller;

import core.BaseServlet;
import service.PermissionService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 权限管理模块
 */
@WebServlet(name = "permissionServlet", urlPatterns = "/permission")
public class PermissionServlet extends BaseServlet {

    private PermissionService permissionService = new PermissionService();



    /**
     * 权限管理页面数据
     * @param request
     * @param response
     * @throws ServletException
     * @throws IOException
     */
    public void permissionManagePage(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        permissionService.permissionListByParam(request, response);
    }

    /**
     * 权限管理页面
     * @param request
     * @param response
     * @throws ServletException
     * @throws IOException
     */
    public void permissionPage(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.getRequestDispatcher("/WEB-INF/pages/baseInfo/permission/permissionManage.jsp").forward(request, response);
    }

    /**
     * 根据职位查找权限
     * @param request
     * @param response
     * @throws ServletException
     * @throws IOException
     */
    public void findPermissionByDC(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        permissionService.findPermissionByDC(request, response);
    }

    /**
     * 编辑权限
     * @param request
     * @param response
     * @throws ServletException
     * @throws IOException
     */
    public void editPermission(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        permissionService.editPermission(request, response);
    }



}
